﻿using Hec.TextMining;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tests
{
    public static class ObjectsCreation
    {
        public static List<Hec.TextMining.KeyValuePair<Document, List<Hec.TextMining.KeyValuePair<string, Cell>>>> TF_IDF_Weights
        {
            get
            {
                #region Creation of test obect
                var test = new List<Hec.TextMining.KeyValuePair<Document, List<Hec.TextMining.KeyValuePair<string, Cell>>>>();
                var docA = new Document("A") { ID = 1 };
                var docB = new Document("B") { ID = 2 };
                var docC = new Document("C") { ID = 3 };

                test.Add(new Hec.TextMining.KeyValuePair<Document, List<Hec.TextMining.KeyValuePair<string, Cell>>>(
                        docA,
                        new List<Hec.TextMining.KeyValuePair<string, Cell>>() 
                    { 
                        new Hec.TextMining.KeyValuePair<string, Cell>("t1", new Cell(0.2385606, docA)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t2", new Cell(0.0704365, docA)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t3", new Cell(0, docA)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t4", new Cell(0, docA))

                    }));

                test.Add(new Hec.TextMining.KeyValuePair<Document, List<Hec.TextMining.KeyValuePair<string, Cell>>>(
                        docB,
                        new List<Hec.TextMining.KeyValuePair<string, Cell>>() 
                    { 
                        new Hec.TextMining.KeyValuePair<string, Cell>("t1", new Cell(0, docB)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t2", new Cell(0.0528274, docB)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t3", new Cell(0.0176, docB)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t4", new Cell(0, docB))
                    }));

                test.Add(new Hec.TextMining.KeyValuePair<Document, List<Hec.TextMining.KeyValuePair<string, Cell>>>(
                        docC,
                        new List<Hec.TextMining.KeyValuePair<string, Cell>>() 
                    { 
                        new Hec.TextMining.KeyValuePair<string, Cell>("t1", new Cell(0, docC)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t2", new Cell(0, docC)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t3", new Cell(0, docC)),
                        new Hec.TextMining.KeyValuePair<string, Cell>("t4", new Cell(0.066034, docC))
                    }));


                #endregion

                return test;
            }

        }

        public static List<Hec.TextMining.KeyValuePair<Document, List<string>>> _5Dimension_Random_Frequencies_with_2_wanted_clusters
        {
            get
            {
                #region Creation 50 obects with variables associated To Cluster 1
                var test = new List<Hec.TextMining.KeyValuePair<Document, List<string>>>();

                var random = new Random(1234);
                //50 documents : only terms : 2, 3, 5
                for (int i = 0; i < 50; i++)
                {
                    var doc = new Document("doc_" + i.ToString()) { ID = i };
                    var strings = new List<string>();

                    //5 terms
                    var t1Rand = random.Next(0, 0);
                    for (int j = 0; j < t1Rand; j++)
                    {
                        strings.Add("t_1");
                    }


                    var t2Rand = random.Next(200, 300);
                    for (int j = 0; j < t2Rand; j++)
                    {
                        strings.Add("t_2");
                    }

                    var t3Rand = random.Next(30, 100);
                    for (int j = 0; j < t3Rand; j++)
                    {
                        strings.Add("t_3");
                    }

                    var t4Rand = random.Next(0, 0);
                    for (int j = 0; j < t4Rand; j++)
                    {
                        strings.Add("t_4");
                    }

                    var t5Rand = random.Next(50, 100);
                    for (int j = 0; j < t5Rand; j++)
                    {
                        strings.Add("t_5");
                    }

                    test.Add(new Hec.TextMining.KeyValuePair<Document, List<string>>(doc, strings));
                }

                //50 documents, terms, 1, 4
                for (int i = 50; i < 100; i++)
                {
                    var doc = new Document("doc_" + i.ToString()) { ID = i };
                    var strings = new List<string>();

                    //5 terms
                    var t1Rand = random.Next(200, 300);
                    for (int j = 0; j < t1Rand; j++)
                    {
                        strings.Add("t_1");
                    }

                    var t2Rand = random.Next(0, 0);
                    for (int j = 0; j < t2Rand; j++)
                    {
                        strings.Add("t_2");
                    }

                    var t3Rand = random.Next(0, 0);
                    for (int j = 0; j < t3Rand; j++)
                    {
                        strings.Add("t_3");
                    }

                    var t4Rand = random.Next(50, 250);
                    for (int j = 0; j < t4Rand; j++)
                    {
                        strings.Add("t_4");
                    }

                    var t5Rand = random.Next(0, 0);
                    for (int j = 0; j < t5Rand; j++)
                    {
                        strings.Add("t_5");
                    }

                    test.Add(new Hec.TextMining.KeyValuePair<Document, List<string>>(doc, strings));
                }


                #endregion

                return test;
            }

        }

        public static List<Hec.TextMining.KeyValuePair<Document, List<string>>> _5Dimension_Random_Frequencies_with_3_wanted_clusters
        {
            get
            {
                #region Creation 50 obects with variables associated To Cluster 1
                var test = new List<Hec.TextMining.KeyValuePair<Document, List<string>>>();

                var random = new Random(1234);

                #region cluster 1
                //100 documents : only terms : 1,2,3,4,5
                for (int i = 0; i < 100; i++)
                {
                    var doc = new Document("doc_" + i.ToString()) { ID = i };
                    var strings = new List<string>();

                    //5 terms
                    var t1Rand = random.Next(0, 10);
                    for (int j = 0; j < t1Rand; j++)
                    {
                        strings.Add("t_1");
                    }


                    var t2Rand = random.Next(200, 300);
                    for (int j = 0; j < t2Rand; j++)
                    {
                        strings.Add("t_2");
                    }

                    var t3Rand = random.Next(30, 100);
                    for (int j = 0; j < t3Rand; j++)
                    {
                        strings.Add("t_3");
                    }

                    var t4Rand = random.Next(10, 30);
                    for (int j = 0; j < t4Rand; j++)
                    {
                        strings.Add("t_4");
                    }

                    var t5Rand = random.Next(50, 100);
                    for (int j = 0; j < t5Rand; j++)
                    {
                        strings.Add("t_5");
                    }

                    test.Add(new Hec.TextMining.KeyValuePair<Document, List<string>>(doc, strings));
                } 
                #endregion

                #region cluster 2

                for (int i = 100; i < 200; i++)
                {
                    var doc = new Document("doc_" + i.ToString()) { ID = i };
                    var strings = new List<string>();

                    //5 terms
                    var t1Rand = random.Next(0, 10);
                    for (int j = 0; j < t1Rand; j++)
                    {
                        strings.Add("t_6");
                    }


                    var t2Rand = random.Next(200, 300);
                    for (int j = 0; j < t2Rand; j++)
                    {
                        strings.Add("t_7");
                    }

                    var t3Rand = random.Next(30, 100);
                    for (int j = 0; j < t3Rand; j++)
                    {
                        strings.Add("t_8");
                    }

                    var t4Rand = random.Next(10, 30);
                    for (int j = 0; j < t4Rand; j++)
                    {
                        strings.Add("t_9");
                    }

                    var t5Rand = random.Next(50, 100);
                    for (int j = 0; j < t5Rand; j++)
                    {
                        strings.Add("t_10");
                    }

                    test.Add(new Hec.TextMining.KeyValuePair<Document, List<string>>(doc, strings));
                } 
                #endregion

                #region cluster 3

                for (int i = 200; i < 300; i++)
                {
                    var doc = new Document("doc_" + i.ToString()) { ID = i };
                    var strings = new List<string>();

                    //5 terms
                    var t1Rand = random.Next(0, 10);
                    for (int j = 0; j < t1Rand; j++)
                    {
                        strings.Add("t_10");
                    }


                    var t2Rand = random.Next(200, 300);
                    for (int j = 0; j < t2Rand; j++)
                    {
                        strings.Add("t_11");
                    }

                    var t3Rand = random.Next(30, 100);
                    for (int j = 0; j < t3Rand; j++)
                    {
                        strings.Add("t_12");
                    }

                    var t4Rand = random.Next(10, 30);
                    for (int j = 0; j < t4Rand; j++)
                    {
                        strings.Add("t_13");
                    }

                    var t5Rand = random.Next(50, 100);
                    for (int j = 0; j < t5Rand; j++)
                    {
                        strings.Add("t_14");
                    }

                    test.Add(new Hec.TextMining.KeyValuePair<Document, List<string>>(doc, strings));
                }
                #endregion

                #endregion

                return test;
            }

        }

    }
}
